//
//  LkTestpageNameBottomCell.m
//  YLHelper
//
//  Created by she1323 on 2018/5/9.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LkTestpageNameBottomCell.h"

@implementation LkTestpageNameBottomCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setLabelContent];
    // Initialization code
}
-(void)setLabelContent{
    self.titleLabel.text = @"【选择题】这是一个不好玩的事儿打卡；来的拉大妈妈吃辣马上来美联储；美丽聪明了马上拉什么才拉出马黎明路撒参谋参谋拉萨出门";
    self.defaultImage = [UIImage imageNamed:@"elarningweixuanze"];
    self.sigleselectedImage = [UIImage imageNamed:@"elarningxuanzeright"];
    self.doubleselctedImage = [UIImage imageNamed:@""];
    NSMutableAttributedString *strA = [self setLabelPictureWithImage:self.defaultImage];
    [strA appendString:@" A:健身卡可大可来得及阿克苏的拉动就爱看离得近奥斯卡的捡垃圾大快乐圣诞节"];
    self.Alabel.attributedText = strA;
    NSMutableAttributedString *strB = [self setLabelPictureWithImage:self.sigleselectedImage];
    [strB appendString:@" B:健身卡可大可来得及阿克苏的拉动就爱看离得近奥斯卡的捡垃圾大快乐圣诞节"];
    self.Blabel.attributedText = strB;
    NSMutableAttributedString *strC = [self setLabelPictureWithImage:self.defaultImage];
    [strC appendString:@" C:健身卡可大可来得及阿克苏的拉动就爱看离得近奥斯卡的捡垃圾大快乐圣诞节"];
    self.Clabel.attributedText = strC;
    NSMutableAttributedString *strD = [self setLabelPictureWithImage:self.defaultImage];
    [strD appendString:@" D:健身卡可大可来得及阿克苏的拉动就爱看离得近奥斯卡的捡垃圾大快乐圣诞节"];
    self.Dlabel.attributedText = strD;

    NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:@"正确答案:A"];
    [attri addAttribute:NSForegroundColorAttributeName value:blueDefault range:NSMakeRange(0, 4)];
    [attri addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, 4)];
    NSMutableAttributedString *attri0 = [[NSMutableAttributedString alloc] initWithString:@"正确答案:B"];
    [attri0 addAttribute:NSForegroundColorAttributeName value:blueDefault range:NSMakeRange(0, 4)];
    [attri0 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, 4)];
    NSMutableAttributedString *attri1 = [[NSMutableAttributedString alloc] initWithString:@"答案解析:打瞌睡了的拉动卡了；扩大；打卡；来的拉大妈妈吃辣马上来美联储；美丽聪明了马上拉什么才拉出马黎明路撒参谋参谋拉萨出门"];
    [attri1 addAttribute:NSForegroundColorAttributeName value:blueDefault range:NSMakeRange(0, 4)];
    [attri1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, 4)];
    self.rightanswerLabel.attributedText = attri;
    self.youranswerLabel.attributedText = attri0;
    self.analysicLabel.attributedText = attri1;
}

/**
 设置label文字前段的图片

 @param image 图片
 @return 可变富文本
 */
-(NSMutableAttributedString *)setLabelPictureWithImage:(UIImage *)image{
    NSTextAttachment *textAttach = [[NSTextAttachment alloc]init];
    textAttach.image = image;
    NSAttributedString *alabelStr = [NSAttributedString attributedStringWithAttachment:textAttach];
    NSMutableAttributedString *strw = [[NSMutableAttributedString alloc] initWithAttributedString:alabelStr];
    return strw;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
